# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User

#class Parent(models.Model):
#    name = models.ForeignKey(User, unique = True)
#    birth = models.DateField("What's your birthday?")
#    gender = models.BooleanField("Are you mother?")
#    cellphone = models.CharField(max_length = 50)
#    
#    def __str__(self):
#        return self.name   

class Baby(models.Model):
    GENDER_CHOICES = (
        (u'M', u'Male'),
        (u'F', u'Female'),
    )
    parent = models.ForeignKey(User)
    name = models.CharField(max_length = 50, unique = True)
    birth = models.DateTimeField("baby's birthday")
    gender = models.CharField(max_length = 2, choices = GENDER_CHOICES)    
    
    def __unicode__(self):
        return self.name      

class HeightHistory(models.Model):     
    baby = models.ForeignKey(Baby)
    record_date = models.DateTimeField("Height History date")
    height = models.IntegerField()
    # FIX_ME
    def __unicode__(self):
        return self.baby.name    
    
class WeightHistory(models.Model):     
    baby = models.ForeignKey(Baby)
    record_date = models.DateTimeField("Weight History date")   
    weight = models.IntegerField()
    # FIX_ME
#    def __str__(self):
#        return self.baby
    def __unicode__(self):
        return self.baby.name        

class BabyFoodHistory(models.Model):
    baby = models.ForeignKey(Baby)
    record_date = models.DateTimeField("Baby food date")
    menu = models.CharField(max_length = 100)
    capacity = models.CharField(max_length = 50, blank = True)
    # FIX_ME
#    def __str__(self):
#        return self.baby
    def __unicode__(self):
        return self.baby.name
        
class ChildcareDairy(models.Model):
    baby = models.ForeignKey(Baby)
    record_date = models.DateTimeField("Child care dairy date")
    memo = models.TextField()
    # FIX_ME
#    def __str__(self):
#        return self.baby
    def __unicode__(self):
        return self.baby.name
        
class PhotoHistory(models.Model):
    baby = models.ForeignKey(Baby)
    record_date = models.DateTimeField("Photo History date")
    photo_file = models.ImageField(upload_to='media')
    gps_info = models.CharField(max_length = 50, blank = True)
    voice_file = models.FileField(upload_to='media', blank = True)
    memo = models.TextField(blank = True)   
    # FIX_ME
#    def __str__(self):
#        return self.baby
    def __unicode__(self):
        return self.baby.name    